Skip to content

ui: Add dev.perfetto.JournaldLog plugin and update AndroidLog (3/3)#5798

Open
staticfloat wants to merge 3 commits into
google:mainfrom
staticfloat:sf/journald-part-3
Open

ui: Add dev.perfetto.JournaldLog plugin and update AndroidLog (3/3)#5798
staticfloat wants to merge 3 commits into
google:mainfrom
staticfloat:sf/journald-part-3

Conversation

@staticfloat
Copy link
Copy Markdown

Add a new JournaldLog plugin (dev.perfetto.JournaldLog) that displays
journald log entries from the linux.journald data source. The plugin
shares UI components with the existing AndroidLog plugin, extracted into:

  • ui/src/components/tracks/log_track.ts: generic log track factory
  • ui/src/components/widgets/log_panel/log_panel.ts: shared LogPanel
    component with filtering, search, and per-source extensibility

The AndroidLog plugin is refactored to use these shared components.
Register dev.perfetto.JournaldLog in default_plugins.ts.

This is part 3 of a split-up version of #5331 and will close #3288.

This PR was co-written by AI; while I iterated on it until the look and feel felt correct, there may be context or use cases that I am unaware of. I am open to all review comments, and will do my best to address them.

@staticfloat staticfloat requested a review from a team as a code owner May 10, 2026 00:03
@staticfloat
Copy link
Copy Markdown
Author

Note that because gh stack says that this repository doesn't have stacks enabled, I wasn't able to use that new feature, so this branch contains the two commits before it.

@stevegolton stevegolton self-requested a review May 11, 2026 13:39
@staticfloat staticfloat force-pushed the sf/journald-part-3 branch 2 times, most recently from a3afd08 to 0839611 Compare May 13, 2026 16:39
Add a new `linux.journald` data source to `traced_probes` that reads log
entries from the systemd journal via `libsystemd`. The library is loaded
at runtime via dlopen("libsystemd.so.0") so there is no compile-time
dependency on libsystemd.

New protos:
- `JournaldConfig` in `protos/perfetto/config/linux/journald_config.proto`
- `JournaldEventPacket` in `protos/perfetto/trace/linux/journald_event.proto`

The data source opens the journal with sd_journal_open(), and emits one
JournaldEventPacket per entry containing: timestamp, pid, priority,
tag, message, uid, comm, systemd_unit, hostname and transport.
Refactor `AndroidLogTable` into a unified `LogTable` (`log_tables.py`,
exposed as `__intrinsic_logs`) that stores log entries from all sources.
A new log_source STRING column identifies the origin: 'android' or
'journald'. `LogTable` is moved out of `android_tables.py` into its own
`log_tables.py` since it is no longer Android-specific.

New linux_probes_parser.cc parses `JournaldEventPacket` and inserts into
`LogTable` with log_source='journald'. Journald-specific metadata
(uid, comm, systemd_unit, hostname, transport) is stored via `ArgsTracker`.

Three SQL views are provided in the prelude:
- logs: all entries from all sources
- android_logs: convenience alias for log_source='android' entries
- journald_logs: journald entries with metadata columns via extract_arg()

Diff tests updated and a new Linux diff test suite covers journald
parsing.
Add a new JournaldLog plugin (dev.perfetto.JournaldLog) that displays
journald log entries from the linux.journald data source. The plugin
shares UI components with the existing AndroidLog plugin, extracted into:

- ui/src/components/tracks/log_track.ts: generic log track factory
- ui/src/components/widgets/log_panel/log_panel.ts: shared LogPanel
  component with filtering, search, and per-source extensibility

The AndroidLog plugin is refactored to use these shared components.

This adds a new `Linux` section to the `Record new trace` page in the
UI, adding the `linux.journald` datasource as the first section.  In
order to properly allow configuration of the minimum priority to
capture, a `dropdown` widget is added.
@staticfloat staticfloat force-pushed the sf/journald-part-3 branch from 0839611 to 7c2430b Compare May 15, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux journald logs datasource

1 participant